import request from '@/utils/request'
import cache from "@/plugins/cache";

const projectObj = {
  state: {
    projectName: ''
  },
  mutations: {
    SET_PROJECTNAME: (state, projectName) => {
      state.projectName = projectName
    }
  },
  actions: {
    // 获取项目信息
    GetProjectName({ commit, state }) {
      let projectName = cache.local.get("currentProjectName");
      commit('SET_PROJECTNAME', projectName)
    },
  }
}
export default projectObj
// 查询项目信息列表
export function listAppmanager(query) {
  return request({
    url: '/system/appmanager/list',
    method: 'get',
    params: query
  })
}

// 查询项目信息详细
export function getAppmanager(appid) {
  return request({
    url: '/system/appmanager/' + appid,
    method: 'get'
  })
}

// 新增项目信息
export function addAppmanager(data) {
  return request({
    url: '/system/appmanager',
    method: 'post',
    data: data
  })
}

// 修改项目信息
export function updateAppmanager(data) {
  return request({
    url: '/system/appmanager',
    method: 'put',
    data: data
  })
}

// 删除项目信息
export function delAppmanager(appid) {
  return request({
    url: '/system/appmanager/' + appid,
    method: 'delete'
  })
}

//
export function restoredAppmanager(appid) {
  return request({
    url: '/system/appmanager/restored/' + appid,
    method: 'put'
  })
}

// 查询部门下拉树结构
export function appTypeSelect() {
  return request({
    url: '/system/apptype/listAll',
    method: 'get'
  })
}

// 初始化项目信息
export function initAppmanager(appid) {
  return request({
    url: '/system/appmanager/init/' + appid,
    method: 'get'
  })
}

//
export function fixAppmanager(appid) {
  return request({
    url: '/system/appmanager/fix/' + appid,
    method: 'get'
  })
}

// 查询部门下拉树结构
export function deptTreeSelect() {
  return request({
    url: '/system/appmanager/deptTree',
    method: 'get'
  })
}
